﻿using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel;

namespace T.FAS.Runtime.Metadata.Entity.MF
{
    public class MicroflowMeta : IMetaDataContent
    {
        public string ID { get; set; }
        public string Name { get; set; }
        public string Code { get; set; }
        public string Description { get; set; }
        public Dictionary<string, object> DesignData { get; set; }
        /// <summary>
        /// 入参
        /// </summary>
        public List<MicroflowParam> Params { get; set; }
        /// <summary>
        /// 依赖的元数据
        /// </summary>
        public List<MicroflowDependency> Dependencies { get; set; }
        public List<MicroflowOutput> Outputs { get; set; }
        #region 
        public string MetaDataID { get; set; }
        public string MetaDataCode { get; set; }
        public string MetaDataName { get; set; }
        public DateTime CreateTime { get; set; }
        public string Creator { get; set; }
        public DateTime LastModifyTime { get; set; }
        public string LastModifier { get; set; }
        [JsonIgnore]
        public IMetaData MetaData { get; set; }
        public string ProjectBranchID { get; set; }

        public event PropertyChangedEventHandler PropertyChanged;

        public object Clone()
        {
            return default;
        }
        #endregion
    }
    public class MicroflowParam
    {
        public string ID { get; set; }
        public string Name { get; set; }
        public string DataType { get; set; }
        public string Description { get; set; }
        /// <summary>
        /// 1:入参，2：全局变量
        /// </summary>
        public int ParamType { get; set; }
        public bool Required { get; set; }
    }
    public class MicroflowDependency
    {
        [JsonProperty("metaDataId")]
        public string MetaDataID { get; set; }
        [JsonProperty("metaTypeId")]
        public string MetaTypeID { get; set; }
        [JsonProperty("metaDataCode")]
        public string MetaDataCode { get; set; }
        [JsonProperty("metaDataName")]
        public string MetaDataName { get; set; }
      
    }

    public class MicroflowOutput
    {
        [JsonProperty("NodeId")]
        public string NodeID { get; set; }
        [JsonProperty("NodeName")]
        public string NodeName { get; set; }
        [JsonProperty("OutputFields")]
        public List<MicroflowOutputField> OutputFields { get; set; }
    }
    public class MicroflowOutputField
    {
        [JsonProperty("id")]
        public string ID { get; set; }
        [JsonProperty("variable")]
        public string Variable { get; set; }
        [JsonProperty("label")]
        public string Label { get; set; }
        [JsonProperty("valueType")]
        public string ValueType { get; set; }
        [JsonProperty("type")]
        public string Type { get; set; }
        [JsonProperty("variableId")]
        public string VariableID { get; set; }
        [JsonProperty("variableNodeId")]
        public string VariableNodeID { get; set; }
        [JsonProperty("variableType")]
        public string VariableType { get; set; }
        [JsonProperty("variableValue")]
        public string VariableValue { get; set; }
    }
}
